Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: FEATURE: Rework CR CatchUp mechanism #4988

Draft
wants to merge 34 commits into
base: 9.0
Choose a base branch
from

Conversation

bwaidelich
Copy link
Member

@bwaidelich bwaidelich commented Apr 11, 2024

related: #4746

WIP because:

@github-actions github-actions bot added the 9.0 label Apr 11, 2024
@bwaidelich bwaidelich force-pushed the feature/4746-rework-catchup-mechanism branch from 1138434 to 3a2fc46 Compare April 11, 2024 15:57
@@ -44,7 +44,6 @@ public function __construct()
self::bootstrapFlow();
$this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class);

$this->setupCRTestSuiteTrait();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer needed, see

{
$store = new SemaphoreStore();
$factory = new LockFactory($store);
$lock = $factory->createLock('catchup');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: This lock needs to be CR specific (i.e. include $this->id)

@@ -153,6 +159,67 @@ public function projectionState(string $projectionStateClassName): ProjectionSta
throw new \InvalidArgumentException(sprintf('A projection state of type "%s" is not registered in this content repository instance.', $projectionStateClassName), 1662033650);
}

public function catchUpProjections(): void
{
$store = new SemaphoreStore();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to become an external dependency and/or coordinated with #4751

@nezaniel
Copy link
Member

This already looks very promising and I like the direction this is taking!
What part is still missing / incomplete? Just the new catchup implementation, right?

@bwaidelich
Copy link
Member Author

This already looks very promising and I like the direction this is taking!

Thanks for the feedback, appreciated!

What part is still missing / incomplete?

I added some more lines to the task list above

Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a lot of stuff but looks "good" so far (considering this is WIP) ... i went through all php classes by reading except the last 20 with only the +-1 changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this file now? ^^

Comment on lines +93 to +94
#print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));exit;
#\Neos\Flow\var_dump('HANDLE ' . $command::class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wip

Comment on lines +129 to +136
return new class {
/**
* @deprecated backwards compatibility layer
*/
public function block(): void
{
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we were to merge this like this - which i think is not necessary - we should use an actual class so its inspectable via phpstorm :) But i dont think we need b/c layer for new code

$catchUpHook?->onBeforeEvent($event, $eventEnvelope);
$projection->apply($event, $eventEnvelope);
// TODO this should happen in the inner transaction
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo over here :)

];
$projectionsAndCatchUpHooks[$projectionClassName]['catchUpHook']?->onBeforeCatchUp();
}
#\Neos\Flow\var_dump('CATCHUP from ' . $lowestAppliedSequenceNumber->value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. lots of debug code and i guess todos?

Copy link
Member

@mhsdesign mhsdesign Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this is now part of CheckpointHelper? Good thing we have it in the Core and now our lower level package ^^

@mhsdesign
Copy link
Member

mhsdesign commented May 17, 2024

i just merged 9.0 into your pr. A few notes from my side:

  • \ContentGraphTableNames::tableNamePrefix is now public again because its passed to the separate package DbalTools this makes ContentGraphTableNames::checkpoint obsolete as well ... should be adjusted
  • i started merging the .feature behat tests but at last i decided to just accept 9.0 as it was getting tedious. My assumption based on the features i have seen changed is that only the blocking part was removed. As discussed ill split this up into a separate pr either way.
  • the (new - from the frankfurt sprint) shallow packages Neos.ContentRepositoryRegistry.DoctrineDbalClient Neos.ContentRepositoryRegistry.PostgresDbalClient seem to be now obsolete which is good imo (we have too much stuff first level for any new contributor. They should be removed.
  • Due to only having the CommandHandlingDependencies at hand we cannot pass the cr to publishEvents to block.

mhsdesign added a commit to mhsdesign/neos-development-collection that referenced this pull request May 17, 2024
This change was partially ported from neos#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in neos#4988)
mhsdesign added a commit to mhsdesign/neos-development-collection that referenced this pull request May 17, 2024
This change was partially ported from neos#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in neos#4988)
neos-bot pushed a commit to neos/contentgraph-doctrinedbaladapter that referenced this pull request May 17, 2024
This change was partially ported from neos/neos-development-collection#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in #4988)
neos-bot pushed a commit to neos/contentrepository-export that referenced this pull request May 17, 2024
This change was partially ported from neos/neos-development-collection#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in #4988)
neos-bot pushed a commit to neos/contentrepository-legacynodemigration that referenced this pull request May 17, 2024
This change was partially ported from neos/neos-development-collection#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in #4988)
neos-bot pushed a commit to neos/contentrepository-testsuite that referenced this pull request May 17, 2024
This change was partially ported from neos/neos-development-collection#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in #4988)
neos-bot pushed a commit to neos/neos that referenced this pull request May 17, 2024
This change was partially ported from neos/neos-development-collection#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in #4988)
neos-bot pushed a commit to neos/timeable-node-visibility that referenced this pull request May 17, 2024
This change was partially ported from neos/neos-development-collection#4988

Following things have been adjusted:

- Removal of the step: The graph projection is fully up to date
  - remove lastCommandOrEventResult
- Removal of the step: The documenturipath projection is up to date
- Use injected Connection in tests instead of DoctrineDbalClient (this will be fully refactored in #4988)
Copy link
Member

@mhsdesign mhsdesign May 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed in #5061 we want to keep the result thing for now and with it the return values here.

git checkout 9.0 -- Neos.ContentRepository.Core/Classes/Service/ContentStreamPruner.php
git checkout 9.0 -- Neos.ContentRepository.NodeMigration

…up-mechanism

# Conflicts:
#	Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php
#	Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Projection/ProjectionIntegrityViolationDetector.php
#	Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ProjectionContentGraph.php
#	Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/HypergraphProjection.php
#	Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Projection/ProjectionHypergraph.php
#	Neos.ContentRepository.Core/Classes/Projection/ContentStream/ContentStreamProjection.php
#	Neos.ContentRepository.Core/Classes/Projection/Workspace/WorkspaceProjection.php
#	Neos.ContentRepositoryRegistry.DoctrineDbalClient/Configuration/Objects.yaml
#	Neos.ContentRepositoryRegistry.DoctrineDbalClient/Configuration/Settings.yaml
#	Neos.ContentRepositoryRegistry.DoctrineDbalClient/composer.json
#	Neos.ContentRepositoryRegistry.PostgresDbalClient/Configuration/Objects.yaml
#	Neos.ContentRepositoryRegistry.PostgresDbalClient/composer.json
#	Neos.ContentRepositoryRegistry/Classes/Command/ContentGraphIntegrityCommandController.php
#	Neos.ContentRepositoryRegistry/Configuration/Objects.yaml
#	Neos.ContentRepositoryRegistry/Configuration/Settings.yaml
#	Neos.Neos/Classes/PendingChangesProjection/ChangeProjection.php
Comment on lines +20 to +21
- Neos.ContentRepositoryRegistry.DoctrineDbalClient
- Neos.ContentRepositoryRegistry.PostgresDbalClient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Neos.ContentRepositoryRegistry.DoctrineDbalClient
- Neos.ContentRepositoryRegistry.PostgresDbalClient

they have been removed again, my change can thus be reverted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take care of the rebasing once my three cleanups #5073 #5074 #5075 are in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants